package NewTmas.EditMode;

import NewTmas.Graphs.GraphVizGraph;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;

/**
 * Created by IntelliJ IDEA.
 * User: abhatnag
 * Date: 8/19/11
 * Time: 12:08 PM
 * To change this template use File | Settings | File Templates.
 */
public class DeleteJobListener implements ActionListener
{

    String jobname;
    GraphVizGraph graphVizGraph;
    Connection connection;
    EditIntFrame editIntFrame;

    public DeleteJobListener(String jobname, GraphVizGraph graphVizGraph, Connection connection, EditIntFrame editIntFrame)
    {
        this.jobname = jobname;
        this.graphVizGraph = graphVizGraph;
        this.connection = connection;
        this.editIntFrame = editIntFrame;

    }

    public void actionPerformed(ActionEvent e)
    {
        CallStoredProc storedProc = new CallStoredProc("{call tms.job_util.remove(?)}", new String[]{jobname}, connection);

        editIntFrame.sqlCommands.add(storedProc);
        editIntFrame.model.addElement(storedProc);
        editIntFrame.sqlcommandsList.setModel(editIntFrame.model);

    }
}
